/**
 * 模拟API响应
 * 在实际部署中，这些应该由真实的后端API提供
 */

// 智能合约信息
const CONTRACT_INFO = {
  address: '0x3486f788b1def23078d0e1108323d3c3cd785402',
  adminAddress: '0x5B38Da6a701c568545dCfcB03FcB875f56beddC4', // 这是一个示例地址，应该是真实的合约部署者地址
  network: 'FISCO BCOS',
  chainId: '1',
  groupId: 1
};

// 模拟获取管理员信息
export const getAdminInfo = () => {
  return new Promise((resolve) => {
    // 模拟网络延迟
    setTimeout(() => {
      resolve({
        status: 'success',
        code: 0,
        data: {
          adminAddress: CONTRACT_INFO.adminAddress,
          contractAddress: CONTRACT_INFO.address,
          network: CONTRACT_INFO.network
        }
      });
    }, 500);
  });
};

// 模拟验证管理员地址
export const verifyAdminAddress = (address) => {
  return new Promise((resolve) => {
    // 模拟网络延迟
    setTimeout(() => {
      const isValid = address.toLowerCase() === CONTRACT_INFO.adminAddress.toLowerCase();
      
      resolve({
        status: isValid ? 'success' : 'error',
        code: isValid ? 0 : 401,
        data: {
          verified: isValid,
          message: isValid ? '验证成功' : '地址不匹配，非管理员地址'
        }
      });
    }, 800);
  });
};

export default {
  getAdminInfo,
  verifyAdminAddress
}; 